<template>
	<view class="radius-10" style="box-shadow: 0px 0px 10px rgba(255, 153, 0, 0.14);" @click="toDetail(item)">
		<view class="img flex1 flex-top" :style="{backgroundImage:'url('+ item.cover +')'}"></view>
		<view class="ptb-20 plr-10">
			<view class="flex1 flex-middle u-line-1">
				<view class="bg-yellow white size-20 plr-10 ptb-4 radius-5" v-if="item.flag">
					{{item.flag}}
				</view>
				<view class="size-26 bold u-line-1 ml-10">
					{{item.title}}
				</view>
			</view>
			<view class="flex1 flex-middle mt-10">
				<view class="size-24 gray-3">
					已售{{item.sales_count}}
				</view>
				<view class="mlr-5 gray-3" v-if="item.distance">
					|
				</view>
				<view class="size-24 gray-3" v-if="item.distance">
					{{item.distance}}km
				</view>
			</view>
			<view class="flex1 flex-middle mt-10">
				<view class="size-26 red">
					<text class="red size-32">{{item.integral}}</text>
					<text class="red size-26">积分</text>
				</view>
				<view class="size-22 gray-3 ml-10" style="text-decoration: line-through;">
					￥{{item.original_price}}
				</view>
				
			</view>
			<view class="mt-15 bg-yellow white text-center radius-10 ptb-10" v-if="item.button_text">
				{{item.button_text}}
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props:{
			hasBtn:{
				type:Boolean,
				default:true
			},
			item:{
				type:Object
			},
		},
		data() {
			return {
			};
		},
		methods:{
			toDetail(item) {
				let url = '/pages/home/good-detail';
				url = (item.url ? item.url : url) + `?id=${item.id}`;
				uni.navigateTo({
					url: url
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.img{
		width: 100%;
		height: 215rpx;
		background-repeat: no-repeat;
		background-size: cover;
		border-radius: 10rpx 10rpx 0 0;
	}
</style>
